package com.example;

/**
 * @author yeqiang
 * @since 2021/8/20 下午2:09
 */
public class InstrunctionRearrange {
    static int LOOP = 100000;
    private static int a = 0;

    public static void main(String[] args) throws InterruptedException {
        int counter = 0;
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < LOOP; i++) {
                    a++;
                    System.out.println(System.nanoTime() + " " + a + " " + Thread.currentThread());
                }
            }
        });

        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < LOOP; i++) {
                    a++;
                    System.out.println(System.nanoTime() + " " + a + " " + Thread.currentThread());
                }
            }
        });

        t1.start();
        t2.start();
    }
}
